package com.bwie.controller;

import com.bwie.domain.TbOrder;
import com.bwie.domain.TbProduct;
import com.bwie.mapper.TbOrderMapper;
import com.bwie.service.TbOrderService;
import com.bwie.utils.R;
import com.bwie.vo.OrderVo;
import com.bwie.vo.PageInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;

@RestController
@RequestMapping(value = "/order/tbOrder")
public class TbOrderController {

    @Autowired
    TbOrderService tbOrderService;

    @RequestMapping(value = "/addOrder")
    public R addOrder(@RequestBody OrderVo orderVo) {
        return tbOrderService.addOrder(orderVo);
    }

    /**
     * 获取订单列表
     * @return
     */
    @PostMapping(value = "/getOrderList")
    public R getOrderList(@RequestBody PageInfoVo pageInfoVo) {
        return tbOrderService.getOrderList(pageInfoVo);
    }

    /**
     * 获取近一周订单总金额
     * @return
     */
    @PostMapping(value = "/getAmountByLastWeek")
    public R getAmountByLastWeek() {
        return tbOrderService.getAmountByLastWeek();
    }

}
